/*
 * WantToBuyDetailActivity.java
 * business
 *
 * Created by chentao on 2017/5/12.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.main.discovery.wanttobuydetail;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.model.WantToBuyModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 求购详情-Activity.
 */
public class WantToBuyDetailActivity extends BaseActivity {

    private WantToBuyDetailFragment mWantToBuyDetailFragment;

    public static void actionStart(Activity activity, String wantId) {
        Intent intent = new Intent(activity, WantToBuyDetailActivity.class);
        intent.putExtra(Intents.EXTRA_WANT_ID, wantId);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mWantToBuyDetailFragment = (WantToBuyDetailFragment) getSupportFragmentManager().findFragmentById(R.id.container_want_to_buy_detail);

        if (mWantToBuyDetailFragment == null) {
            mWantToBuyDetailFragment = WantToBuyDetailFragment.getInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mWantToBuyDetailFragment, R.id.container_want_to_buy_detail);
        }

    }

    @Override
    protected void initPresenter() {
        new WantToBuyDetailPresenter(mWantToBuyDetailFragment, new WantToBuyModel(), getIntent().getExtras().getString(Intents.EXTRA_WANT_ID));
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_want_to_buy_detail;
    }
}
